<template>
<div class="editTeam_box">
  <el-page-header @back="goBack" content="编辑队伍" style="margin-bottom: 20px">
  </el-page-header>
  <div class="table_box">
    <div class="gameName">{{ gameName }}</div>
    <div class="team_member">
      <production :team="team"></production>
      <students :students="students"></students>
      <teacher :teachers="teachers"></teacher>
    </div>
  </div>
</div>
</template>

<script>
import students from "./components/students";
import teacher from "./components/teacher";
import production from "./components/production"
export default {
  name: "editTeam",
  components:{
    students,
    teacher,
    production
  },
  data() {
    return{
      team: {}, // 小组基本信息
      students: [],
      teachers: [],
      gameName: ''
    }
  },
  methods: {
    goBack() {
      window.sessionStorage.removeItem('nuofp');
      window.sessionStorage.removeItem('groupID');
      window.sessionStorage.removeItem('team');
      window.sessionStorage.removeItem('teacher');
      window.sessionStorage.removeItem('gameName');
      this.$router.push('/backIndex/teams')
    },

  //  获取小组成员,指导老师
    async getGroupManInfo(data){
      const res = await this.$api.getGroupManInfo(data)
      this.students = res.data.groupManInfo;
      this.team = JSON.parse(window.sessionStorage.getItem("team"));
      this.gameName = window.sessionStorage.getItem('gameName');
      if(window.sessionStorage.getItem("teacher") !== 'undefined'){
        this.teachers = JSON.parse(window.sessionStorage.getItem("teacher"));
      }
    }
  },
  mounted() {
    this.getGroupManInfo(window.sessionStorage.getItem("groupID"))
  }
}
</script>

<style lang="less" scoped>
.editTeam_box{
    .table_box{
      background-color: #ffff;
      padding: 40px;
      box-shadow: 0 2px 7px rgba(187, 172, 172, 0.49), 0 5px 11px rgba(247, 231, 231, 0.36);
      .gameName{
        font-size: 30px;
        font-weight: bolder;
        text-align: center;
      }
      .team_member{
        width: 1300px;
        margin: 20px auto;
      }
    }

}
</style>
